//
//  FSBaseTableViewController.m
//  Trade
//
//  Created by 刘沿 on 16/4/11.
//  Copyright © 2016年 刘沿. All rights reserved.
//

#import "FSBaseTableViewController.h"

@interface FSBaseTableViewController ()

@end

@implementation FSBaseTableViewController

-(NSMutableArray*)contentsArray{
    
    if (_contentsArray == nil) {
        _contentsArray = [NSMutableArray array];
    }
    
    return _contentsArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    __weak typeof(self) weakSelf = self;
    if (self.isNeedRefresh) {
        [self.tableView addHeaderWithCallback:^{
            [weakSelf requestData];
        }];
        
        [self.tableView addFooterWithCallback:^{
            if ((self.currentPage - 1)*KPageSize < self.totalNumber) {
                [weakSelf requestMoreData];
            }else{
                [weakSelf.view.window makeToast:@"没有更多数据了"];
                [weakSelf.tableView footerEndRefreshing];
            }
            
        }];
    }
}
//请求数据
-(void)requestData{
    
    
}
//加载更多
-(void)requestMoreData{
    
    
    
}

-(void)refreshData{
    self.currentPage = 1;
    [self requestData];
}



@end





